package tests;

import static org.junit.Assert.*;
import org.junit.*;
import main.*;

public class SolveEquationTest {
	@Test(expected=ArithmeticException.class)
	public void test1() {
		SolveEquation se = new SolveEquation(1.0, -2.0, 3.0);
		se.getSolutions();
	}

	@Test
	public void test2() {
		SolveEquation se = new SolveEquation(1.0, 0.0, 0.0);
		assertTrue("Same solutions", se.getSolutions().isIdenticalPair());
		assertEquals(se.getNbSolutions(), 1);
	}

	@Test(expected=ArithmeticException.class)
	public void test3() {
		SolveEquation se = new SolveEquation(5.0, 0.0, 3.0);
		se.getSolutions(); //discard the result
	}

	@Test
	public void test4() {
		SolveEquation se = new SolveEquation(3.0, 0.0, 0.0);
		assertEquals(se.getNbSolutions(), 1);
		assertTrue("Same solutions", se.getSolutions().isIdenticalPair());
	}

	@Test(expected=ArithmeticException.class)
	public void test5() {
		SolveEquation se = new SolveEquation(1.0, 0.0, 1.0);
		se.getSolutions(); //discard the result
	}

}
